package su.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import su.domain.Dep;
import su.service.DepService;

import java.util.List;

@Controller
@RequestMapping(path = "/dep")
public class DepController {

    @Autowired
    private DepService depService;

    @RequestMapping(path = "/findAll")
    public String findAll(Model model) {
        List<Dep> deps = depService.findAll();
        model.addAttribute("deps", deps);
        return "success";
    }
}
